#!/bin/bash

USE_TCP=false

if [ $# -gt 0 ]; then
    case $1 in
        --use-tcp)
            USE_TCP=true
            ;;
        *)
            echo "不支持的参数: $1"
            exit 1
            ;;
    esac
    shift
fi

if [ $# -ne 0 ]; then
    echo "不支持的参数: $*"
    exit 1
fi

conda --version > /dev/null 2>&1
if [ $? -ne 0 ]; then
    echo "无法执行'conda'命令，请检查'conda'是否已安装并在'PATH'中。"
    exit 1
fi

conda env list | grep -q "^SmartUI\s"
if [ $? -ne 0 ]; then
    echo "没有找到名为'SmartUI'的conda环境，请确保已创建该环境。"
    exit 1
fi

ENV_PATH=$(conda env list | grep "^SmartUI\s" | awk '{print $2}')
source "$ENV_PATH/bin/activate" SmartUI